package J11_9;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int n = in.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = in.nextInt();
        }
        int q =in.nextInt();
        boolean[] p = new boolean[n + 1];
        for (int i = 0; i < q; i++) {
            int cur = in.nextInt();
            if (!p[cur]) {
                x += w[cur - 1];
                p[cur] = !p[cur];
            } else {
                x -= w[cur - 1];
                p[cur] = !p[cur];
            }
            System.out.println(x);
        }
    }
}
